<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QPaintDevice Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPaintDevice Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPaintDevice class is the base class of objects that can be
painted. <a href="#details">More...</a></p>

<p>Inherited by <a href="qglframebufferobject.html">QGLFramebufferObject</a>, <a href="qglpixelbuffer.html">QGLPixelBuffer</a>, <a href="qimage.html">QImage</a>, <a href="qpicture.html">QPicture</a>, <a href="qpixmap.html">QPixmap</a>, <a href="qprinter.html">QPrinter</a>, <a href="qsvggenerator.html">QSvgGenerator</a> and <a href="qwidget.html">QWidget</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qpaintdevice.html#PaintDeviceMetric-enum">PaintDeviceMetric</a></b> { PdmWidth, PdmHeight, PdmWidthMM, PdmHeightMM, ..., PdmPhysicalDpiY }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpaintdevice.html#QPaintDevice">__init__</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#colorCount">colorCount</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#depth">depth</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#height">height</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#heightMM">heightMM</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#logicalDpiX">logicalDpiX</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#logicalDpiY">logicalDpiY</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#metric">metric</a></b> (<i>self</i>, PaintDeviceMetric&#160;<i>metric</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#numColors">numColors</a></b> (<i>self</i>)</li><li><div class="fn" />QPaintEngine <b><a href="qpaintdevice.html#paintEngine">paintEngine</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpaintdevice.html#paintingActive">paintingActive</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#physicalDpiX">physicalDpiX</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#physicalDpiY">physicalDpiY</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#width">width</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpaintdevice.html#widthMM">widthMM</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPaintDevice class is the base class of objects that can be
painted.</p>
<p>A paint device is an abstraction of a two-dimensional space that
can be drawn using a <a href="qpainter.html">QPainter</a>. Its
default coordinate system has its origin located at the top-left
position. X increases to the right and Y increases downwards. The
unit is one pixel.</p>
<p>The drawing capabilities of QPaintDevice are currently
implemented by the <a href="qwidget.html">QWidget</a>, <a href="qimage.html">QImage</a>, <a href="qpixmap.html">QPixmap</a>,
<a href="qglpixelbuffer.html">QGLPixelBuffer</a>, <a href="qpicture.html">QPicture</a>, and <a href="qprinter.html">QPrinter</a> subclasses.</p>
<p>To implement support for a new backend, you must derive from
QPaintDevice and reimplement the virtual <a href="qpaintdevice.html#paintEngine">paintEngine</a>() function to tell
<a href="qpainter.html">QPainter</a> which paint engine should be
used to draw on this particular device. Note that you also must
create a corresponding paint engine to be able to draw on the
device, i.e derive from <a href="qpaintengine.html">QPaintEngine</a> and reimplement its virtual
functions.</p>
<p><b>Warning:</b> Qt requires that a <a href="qapplication.html">QApplication</a> object exists before any paint
devices can be created. Paint devices access window system
resources, and these resources are not initialized before an
application object is created.</p>
<p>The QPaintDevice class provides several functions returning the
various device metrics: The <a href="qpaintdevice.html#depth">depth</a>() function returns its bit
depth (number of bit planes). The <a href="qpaintdevice.html#height">height</a>() function returns its height
in default coordinate system units (e.g. pixels for <a href="qpixmap.html">QPixmap</a> and <a href="qwidget.html">QWidget</a>)
while <a href="qpaintdevice.html#heightMM">heightMM</a>() returns
the height of the device in millimeters. Similiarily, the <a href="qpaintdevice.html#width">width</a>() and <a href="qpaintdevice.html#widthMM">widthMM</a>() functions return the
width of the device in default coordinate system units and in
millimeters, respectively. Alternatively, the protected <a href="qpaintdevice.html#metric">metric</a>() function can be used to
retrieve the metric information by specifying the desired <a href="qpaintdevice.html#PaintDeviceMetric-enum">PaintDeviceMetric</a> as
argument.</p>
<p>The <a href="qpaintdevice.html#logicalDpiX">logicalDpiX</a>()
and <a href="qpaintdevice.html#logicalDpiY">logicalDpiY</a>()
functions return the horizontal and vertical resolution of the
device in dots per inch. The <a href="qpaintdevice.html#physicalDpiX">physicalDpiX</a>() and <a href="qpaintdevice.html#physicalDpiY">physicalDpiY</a>() functions also
return the resolution of the device in dots per inch, but note that
if the logical and physical resolution differ, the corresponding
<a href="qpaintengine.html">QPaintEngine</a> must handle the
mapping. Finally, the <a href="qpaintdevice.html#colorCount">colorCount</a>() function returns
the number of different colors available for the paint device.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="PaintDeviceMetric-enum" />QPaintDevice.PaintDeviceMetric</h3><p>Describes the various metrics of a paint device.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPaintDevice.PdmWidth</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The width of the paint device in default
coordinate system units (e.g. pixels for <a href="qpixmap.html">QPixmap</a> and <a href="qwidget.html">QWidget</a>).
See also <a href="qpaintdevice.html#width">width</a>().</td>
</tr>
<tr>
<td class="topAlign"><tt>QPaintDevice.PdmHeight</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The height of the paint device in default
coordinate system units (e.g. pixels for <a href="qpixmap.html">QPixmap</a> and <a href="qwidget.html">QWidget</a>).
See also <a href="qpaintdevice.html#height">height</a>().</td>
</tr>
<tr>
<td class="topAlign"><tt>QPaintDevice.PdmWidthMM</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">The width of the paint device in millimeters.
See also <a href="qpaintdevice.html#widthMM">widthMM</a>().</td>
</tr>
<tr>
<td class="topAlign"><tt>QPaintDevice.PdmHeightMM</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign">The height of the paint device in millimeters.
See also <a href="qpaintdevice.html#heightMM">heightMM</a>().</td>
</tr>
<tr>
<td class="topAlign"><tt>QPaintDevice.PdmNumColors</tt></td>
<td class="topAlign"><tt>5</tt></td>
<td class="topAlign">The number of different colors available for
the paint device. See also <a href="qpaintdevice.html#colorCount">colorCount</a>().</td>
</tr>
<tr>
<td class="topAlign"><tt>QPaintDevice.PdmDepth</tt></td>
<td class="topAlign"><tt>6</tt></td>
<td class="topAlign">The bit depth (number of bit planes) of the
paint device. See also <a href="qpaintdevice.html#depth">depth</a>().</td>
</tr>
<tr>
<td class="topAlign"><tt>QPaintDevice.PdmDpiX</tt></td>
<td class="topAlign"><tt>7</tt></td>
<td class="topAlign">The horizontal resolution of the device in
dots per inch. See also <a href="qpaintdevice.html#logicalDpiX">logicalDpiX</a>().</td>
</tr>
<tr>
<td class="topAlign"><tt>QPaintDevice.PdmDpiY</tt></td>
<td class="topAlign"><tt>8</tt></td>
<td class="topAlign">The vertical resolution of the device in dots
per inch. See also <a href="qpaintdevice.html#logicalDpiY">logicalDpiY</a>().</td>
</tr>
<tr>
<td class="topAlign"><tt>QPaintDevice.PdmPhysicalDpiX</tt></td>
<td class="topAlign"><tt>9</tt></td>
<td class="topAlign">The horizontal resolution of the device in
dots per inch. See also <a href="qpaintdevice.html#physicalDpiX">physicalDpiX</a>().</td>
</tr>
<tr>
<td class="topAlign"><tt>QPaintDevice.PdmPhysicalDpiY</tt></td>
<td class="topAlign"><tt>10</tt></td>
<td class="topAlign">The vertical resolution of the device in dots
per inch. See also <a href="qpaintdevice.html#physicalDpiY">physicalDpiY</a>().</td>
</tr>
</table>
<p><b>See also</b> <a href="qpaintdevice.html#metric">metric</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPaintDevice" />QPaintDevice.__init__ (<i>self</i>)</h3><p>Constructs a paint device. This constructor can be invoked only
from subclasses of <a href="qpaintdevice.html">QPaintDevice</a>.</p>


<h3 class="fn"><a name="colorCount" />int QPaintDevice.colorCount (<i>self</i>)</h3><p>Returns the number of different colors available for the paint
device. Since this value is an int, it will not be sufficient to
represent the number of colors on 32 bit displays, in this case
INT_MAX is returned instead.</p>


<h3 class="fn"><a name="depth" />int QPaintDevice.depth (<i>self</i>)</h3><p>Returns the bit depth (number of bit planes) of the paint
device.</p>


<h3 class="fn"><a name="height" />int QPaintDevice.height (<i>self</i>)</h3><p>Returns the height of the paint device in default coordinate
system units (e.g. pixels for <a href="qpixmap.html">QPixmap</a>
and <a href="qwidget.html">QWidget</a>).</p>
<p><b>See also</b> <a href="qpaintdevice.html#heightMM">heightMM</a>().</p>


<h3 class="fn"><a name="heightMM" />int QPaintDevice.heightMM (<i>self</i>)</h3><p>Returns the height of the paint device in millimeters. Due to
platform limitations it may not be possible to use this function to
determine the actual physical size of a widget on the screen.</p>
<p><b>See also</b> <a href="qpaintdevice.html#height">height</a>().</p>


<h3 class="fn"><a name="logicalDpiX" />int QPaintDevice.logicalDpiX (<i>self</i>)</h3><p>Returns the horizontal resolution of the device in dots per
inch, which is used when computing font sizes. For X11, this is
usually the same as could be computed from <a href="qpaintdevice.html#widthMM">widthMM</a>().</p>
<p>Note that if the logicalDpiX() doesn't equal the <a href="qpaintdevice.html#physicalDpiX">physicalDpiX</a>(), the
corresponding <a href="qpaintengine.html">QPaintEngine</a> must
handle the resolution mapping.</p>
<p><b>See also</b> <a href="qpaintdevice.html#logicalDpiY">logicalDpiY</a>() and <a href="qpaintdevice.html#physicalDpiX">physicalDpiX</a>().</p>


<h3 class="fn"><a name="logicalDpiY" />int QPaintDevice.logicalDpiY (<i>self</i>)</h3><p>Returns the vertical resolution of the device in dots per inch,
which is used when computing font sizes. For X11, this is usually
the same as could be computed from <a href="qpaintdevice.html#heightMM">heightMM</a>().</p>
<p>Note that if the logicalDpiY() doesn't equal the <a href="qpaintdevice.html#physicalDpiY">physicalDpiY</a>(), the
corresponding <a href="qpaintengine.html">QPaintEngine</a> must
handle the resolution mapping.</p>
<p><b>See also</b> <a href="qpaintdevice.html#logicalDpiX">logicalDpiX</a>() and <a href="qpaintdevice.html#physicalDpiY">physicalDpiY</a>().</p>


<h3 class="fn"><a name="metric" />int QPaintDevice.metric (<i>self</i>, <a href="qpaintdevice.html#PaintDeviceMetric-enum">PaintDeviceMetric</a>&#160;<i>metric</i>)</h3><p>Returns the metric information for the given paint device
<i>metric</i>.</p>
<p><b>See also</b> <a href="qpaintdevice.html#PaintDeviceMetric-enum">PaintDeviceMetric</a>.</p>


<h3 class="fn"><a name="numColors" />int QPaintDevice.numColors (<i>self</i>)</h3><p>This function is deprecated.</p>
<p>Use <a href="qpaintdevice.html#colorCount">colorCount</a>()
instead.</p>
<p>Returns the number of different colors available for the paint
device. Since this value is an int, it will not be sufficient to
represent the number of colors on 32 bit displays, in this case
INT_MAX is returned instead.</p>


<h3 class="fn"><a name="paintEngine" /><a href="qpaintengine.html">QPaintEngine</a> QPaintDevice.paintEngine (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns a pointer to the paint engine used for drawing on the
device.</p>


<h3 class="fn"><a name="paintingActive" />bool QPaintDevice.paintingActive (<i>self</i>)</h3><p>Returns true if the device is currently being painted on, i.e.
someone has called <a href="qpainter.html#begin">QPainter.begin</a>() but not yet called
<a href="qpainter.html#end">QPainter.end</a>() for this device;
otherwise returns false.</p>
<p><b>See also</b> <a href="qpainter.html#isActive">QPainter.isActive</a>().</p>


<h3 class="fn"><a name="physicalDpiX" />int QPaintDevice.physicalDpiX (<i>self</i>)</h3><p>Returns the horizontal resolution of the device in dots per
inch. For example, when printing, this resolution refers to the
physical printer's resolution. The logical DPI on the other hand,
refers to the resolution used by the actual paint engine.</p>
<p>Note that if the physicalDpiX() doesn't equal the <a href="qpaintdevice.html#logicalDpiX">logicalDpiX</a>(), the
corresponding <a href="qpaintengine.html">QPaintEngine</a> must
handle the resolution mapping.</p>
<p><b>See also</b> <a href="qpaintdevice.html#physicalDpiY">physicalDpiY</a>() and <a href="qpaintdevice.html#logicalDpiX">logicalDpiX</a>().</p>


<h3 class="fn"><a name="physicalDpiY" />int QPaintDevice.physicalDpiY (<i>self</i>)</h3><p>Returns the horizontal resolution of the device in dots per
inch. For example, when printing, this resolution refers to the
physical printer's resolution. The logical DPI on the other hand,
refers to the resolution used by the actual paint engine.</p>
<p>Note that if the physicalDpiY() doesn't equal the <a href="qpaintdevice.html#logicalDpiY">logicalDpiY</a>(), the
corresponding <a href="qpaintengine.html">QPaintEngine</a> must
handle the resolution mapping.</p>
<p><b>See also</b> <a href="qpaintdevice.html#physicalDpiX">physicalDpiX</a>() and <a href="qpaintdevice.html#logicalDpiY">logicalDpiY</a>().</p>


<h3 class="fn"><a name="width" />int QPaintDevice.width (<i>self</i>)</h3><p>Returns the width of the paint device in default coordinate
system units (e.g. pixels for <a href="qpixmap.html">QPixmap</a>
and <a href="qwidget.html">QWidget</a>).</p>
<p><b>See also</b> <a href="qpaintdevice.html#widthMM">widthMM</a>().</p>


<h3 class="fn"><a name="widthMM" />int QPaintDevice.widthMM (<i>self</i>)</h3><p>Returns the width of the paint device in millimeters. Due to
platform limitations it may not be possible to use this function to
determine the actual physical size of a widget on the screen.</p>
<p><b>See also</b> <a href="qpaintdevice.html#width">width</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>